home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Tele / C / Comet2.1.3.cpt / include / task.h < prev    next >
Text File  |  1990-05-11  |  2KB  |  56 lines

  1. /*  Copyright 1983 by the Massachusetts Institute of Technology  */
  2.  
  3. /*
  4.     Copyright Cornell University 1986.  All rights are reserved.
  5.  
  6.     As of 4/10/86:
  7.     This source file may have no changes from the M.I.T original
  8.     other than this notice; but it has been tested as part of 
  9.     Cornell's Aztec-C port.  See notice.h
  10.  
  11. */
  12.  
  13. /* task.h
  14.     4/17/84 - Added tk_sleep().
  15.     5/23/84 - Added tk_exit(), guard words and context switch counting.
  16.                     <John Romkey>
  17. */
  18. /* 3/16/88 kevin added cticks */
  19.  
  20. /* This file contains definitions for the IBM PC tasking package. */
  21.  
  22.  
  23. typedef    char stack;            /* type of data in task stacks */
  24.     /* relaxed to a char type to simplify block move counting -- kevin */
  25. typedef char    event;
  26.  
  27. typedef    struct    task        /* an IBM PC task - top of its stack */
  28. {
  29.     stack    *tk_sp;            /* task's current stack ptr    */
  30.     stack    *tk_fp;            /* task's current frame ptr */
  31.     char    *tk_name;        /* the task's name */
  32.     unsigned long        tk_size;        /* current size of saved stack */
  33.     int        ev_flg;            /* flag set if task is scheduled */
  34.     struct    task *tk_nxt;    /* pointer to next task */
  35.     unsigned tk_count;        /* number of wakeups */
  36.     unsigned *tk_guard;        /* pointer to lowest guardword */
  37.     unsigned tk_alloc;        /* allocated stack size */
  38.     stack    tk_stack[1];    /* top of task's stack */
  39. } *Task;
  40.  
  41. typedef struct task task;
  42.  
  43. extern    struct    task    *tk_cur;        /* currently running task */
  44. extern    struct    task    *tk_main;        /* the first task */
  45. extern    struct    task    *tk_init ();    /* initialize task system */
  46. extern    struct    task    *tk_fork ();    /* fork a new task */
  47. extern struct task * tkrun;    /* give this task priority in running; used for tcp acking */
  48. extern struct task * tkruncomp;    /* return quickly to the process we were executing */
  49. extern    unsigned TDEBUG;                /* tasking debugging */
  50. extern    long tk_wakeups;
  51.  
  52. #ifndef MACTCP
  53. extern unsigned long cticks;            /* current # of ticks elapsed */
  54. #endif
  55.  
  56.